package mgt.pages

class ApiAuthCreatePage extends geb.Page {
    static url = "/apiAuth/create"

    static content = {
        nameField(wait: true) { $("#name") }
        descriptionField(wait: true) { $("#description") }
        apiDefinitionsSelect(wait: true) { $("#apiDefinitions") }

        createButton(to: ApiAuthShowPage) { $(".save") }
    }

    ApiAuthShowPage createApiAuth(String name, String description, Long apiDefinitionId) {
        nameField.value(name)
        descriptionField.value(description)
        apiDefinitionsSelect.value(apiDefinitionId)

        createButton.click()

        return browser.page
    }
}